home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_0799 / 425 / diff1719.zoo / diff1719.txt
Encoding:
Text File  |  1993-08-16  |  57.5 KB  |  2,273 lines

  1. *** 1.7    1993/06/25 21:14:36
  2. --- changes    1993/08/16 23:11:16
  3. ***************
  4. *** 1,6 ****
  5. --- 1,56 ----
  6.   Changes are listed in *reverse* order, most recent changes being
  7.   first.
  8.   
  9. + version 1.09
  10. + biosfs.c:
  11. +     Implement file locking for BIOS devices.
  12. + dosmem.c:
  13. +     Fix the Pexec(200,...) bug (trying to save the command line
  14. +     image must be done *before* the existing program's memory
  15. +     is freed).
  16. + nalloc2.c,util.c:
  17. +     Allow kmalloc()'d memory to be returned to the OS, if possible.
  18. + xbios.c:
  19. +     Dosound() can be called with a negative number as its parameter,
  20. +     in which case it is only an inquiry function.
  21. + version 1.08
  22. + dosfile.c,dosdir.c,filesys.c:
  23. +     Made the file and directory operations re-entrant, by replacing
  24. +     the global variable "temp1" with local variables (where needed).
  25. + dosdir.c,filesys.c: ++schwab@ls5.informatik.uni-dortmund.de
  26. +     Cleaned up the directory closing functions.
  27. + dosmem.c: ++schwab@ls5.informatik.uni-dortmund.de
  28. +     Fixed a bug in do_vfork (the child's PROC structure could be
  29. +     freed when signals are checked for, and the old code wasn't
  30. +     prepared for that).
  31. + purec\*.*: ++reschke@math.uni-muenster.de
  32. +     Updated for the new version of MiNT.
  33. + *.*: ++alex@falcon.demon.co.uk
  34. +     Lots of fixes to get rid of warnings and some small optimizations.
  35. + dosmem.c,procfs.c: ++reschke@math.uni-muenster.de
  36. +     In Pexec, save the name and arguments a process was started with
  37. +     into the PROC structure, so that they can be recovered at run time.
  38. + filesys.c,main.c,unifs.c: ++Ulrich Kuehn
  39. +     At boot time, load files called *.xdd which contain external
  40. +     device drivers.
  41. +     Also, provide Dcntl calls for drive U: to allow installing and
  42. +     de-installing file systems at run time.
  43. + bios.c: ++nox@jelal.north.de
  44. +     Only busy-wait for the parallel port, not for serial ports.
  45. + unifs.c: ++schwab@ls5.informatik.uni-dortmund.de
  46. +     Pass Dcntl commands along to file systems.
  47. + signal.c: ++schwab@ls5.informatik.uni-dortmund.de
  48. +     Make Fselect interruptable.
  49. + procfs.c: ++schwab@ls5.informatik.uni-dortmund.de
  50. +     Check for illegal signal numbers in ioctl(PTRACEGO,...).
  51. + dosdir.c:
  52. +     Fattrib should have been following links.
  53. + *.spp: ++Claus Brod and Uwe Seimet
  54. +     Various optimizations
  55.   version 1.07
  56.   
  57.   debug.c: ++reschke@math.uni-muenster.de
  58. *** 1.7    1993/06/25 21:14:36
  59. --- makefile.lcc    1993/08/10 20:49:24
  60. ***************
  61. *** 42,47 ****
  62. --- 42,48 ----
  63.   DEFS030 = -DONLY030 -DDEBUG_INFO
  64.   
  65.   SYMS = -Hmint.sym
  66. + SYMS030 = -Hmint030.sym
  67.   
  68.   # 30    - pointers do not point to same type of object
  69.   # 86    - formal definitions conflict with type list
  70. ***************
  71. *** 52,64 ****
  72.   # 159    - use of unary minus on unsigned value
  73.   ERRORS = -j30e86e100e104e135i154e159i
  74.   
  75. ! OPTS = -d1 -Oloop -v -cfsb -cag
  76.   ASOPTS = -ma -m8 -d -.
  77.   COPTS = $(OPTS) $(MODEL) $(ERRORS) $(DEFS)
  78.   CFLAGS = $(COPTS) $(SYMS)
  79.   ASFLAGS = $(ASOPTS) $(DEFS)
  80.   COPTS030 = $(OPTS) $(MODEL030) $(ERRORS) $(DEFS030)
  81. ! CFLAGS030 = $(COPTS030) $(SYMS)
  82.   ASFLAGS030 = -m3 $(ASOPTS) $(DEFS030)
  83.   
  84.   LDFLAGS = -t=
  85. --- 53,65 ----
  86.   # 159    - use of unary minus on unsigned value
  87.   ERRORS = -j30e86e100e104e135i154e159i
  88.   
  89. ! OPTS = -d1 -Oloop -v -cfsb -cag -e
  90.   ASOPTS = -ma -m8 -d -.
  91.   COPTS = $(OPTS) $(MODEL) $(ERRORS) $(DEFS)
  92.   CFLAGS = $(COPTS) $(SYMS)
  93.   ASFLAGS = $(ASOPTS) $(DEFS)
  94.   COPTS030 = $(OPTS) $(MODEL030) $(ERRORS) $(DEFS030)
  95. ! CFLAGS030 = $(COPTS030) $(SYMS030)
  96.   ASFLAGS030 = -m3 $(ASOPTS) $(DEFS030)
  97.   
  98.   LDFLAGS = -t=
  99. ***************
  100. *** 66,72 ****
  101.   COBJS = main.o bios.o xbios.o console.o dos.o dosdir.o dosfile.o dosmem.o \
  102.       dossig.o filesys.o mem.o proc.o signal.o timeout.o tty.o util.o \
  103.       biosfs.o pipefs.o procfs.o tosfs.o debug.o rendez.o \
  104. !     unifs.o shmfs.o fasttext.o welcome.o nalloc2.o memprot.o0 realloc.o
  105.   
  106.   COBJS030 = main.o0 bios.o0 xbios.o0 console.o0 dos.o0 dosdir.o0 dosfile.o0 dosmem.o0 \
  107.       dossig.o0 filesys.o0 mem.o0 proc.o0 signal.o0 timeout.o0 tty.o0 util.o0 \
  108. --- 67,73 ----
  109.   COBJS = main.o bios.o xbios.o console.o dos.o dosdir.o dosfile.o dosmem.o \
  110.       dossig.o filesys.o mem.o proc.o signal.o timeout.o tty.o util.o \
  111.       biosfs.o pipefs.o procfs.o tosfs.o debug.o rendez.o \
  112. !     unifs.o shmfs.o fasttext.o welcome.o nalloc2.o memprot.o realloc.o
  113.   
  114.   COBJS030 = main.o0 bios.o0 xbios.o0 console.o0 dos.o0 dosdir.o0 dosfile.o0 dosmem.o0 \
  115.       dossig.o0 filesys.o0 mem.o0 proc.o0 signal.o0 timeout.o0 tty.o0 util.o0 \
  116. ***************
  117. *** 87,107 ****
  118.   all: mint.prg mint030.prg
  119.   
  120.   mint.prg: $(OBJS)
  121. !     $(CC) $(CFLAGS) -o mint.prg $(LDFLAGS) $(OBJS) $(LIBS)
  122.   
  123.   mint030.prg: $(OBJS030)
  124. !     $(CC) $(CFLAGS030) -o mint030.prg $(LDFLAGS) $(OBJS030) $(LIBS)
  125.   
  126.   $(SOBJS) $(SOBJS030): proc.h
  127. ! $(COBJS) $(COBJS030): mint.sym
  128.   
  129.   main.o: version.h
  130.   welcome.o: version.h
  131.   bios.o: inline.h
  132.   
  133. ! mint.sym: mint.h ctype.h assert.h atarierr.h basepage.h types.h \
  134.       signal.h mem.h proc.h file.h sproto.h proto.h inline.h
  135. !     $(CC) $(COPTS) -ph -o mint.sym mint.h
  136.   
  137.   #
  138.   # assembler source files are now handled in a radically different
  139. --- 88,121 ----
  140.   all: mint.prg mint030.prg
  141.   
  142.   mint.prg: $(OBJS)
  143. !     $(CC) $(CFLAGS) -omint.prg $(LDFLAGS) $(OBJS) $(LIBS)
  144.   
  145.   mint030.prg: $(OBJS030)
  146. !     $(CC) $(CFLAGS030) -omint030.prg $(LDFLAGS) $(OBJS030) $(LIBS)
  147.   
  148.   $(SOBJS) $(SOBJS030): proc.h
  149. ! $(COBJS): mint.sym
  150. ! $(COBJS030): mint030.sym
  151.   
  152.   main.o: version.h
  153.   welcome.o: version.h
  154.   bios.o: inline.h
  155.   
  156. ! memprot.o: memprot.c
  157. !     $(CC) -c $(CFLAGS) -m3 -omemprot.o memprot.c
  158. ! main.o0: version.h
  159. ! welcome.o0: version.h
  160. ! bios.o0: inline.h
  161. ! mint.sym mint030.sym: mint.h ctype.h assert.h atarierr.h basepage.h types.h \
  162.       signal.h mem.h proc.h file.h sproto.h proto.h inline.h
  163. ! mint.sym:
  164. !     $(CC) $(COPTS) -ph -omint.sym mint.h
  165. ! mint030.sym:
  166. !     $(CC) $(COPTS030) -ph -omint030.sym mint.h
  167.   
  168.   #
  169.   # assembler source files are now handled in a radically different
  170. ***************
  171. *** 184,202 ****
  172.   .c.o0:
  173.       $(CC) -c $(CFLAGS030) -o$@ $<
  174.   
  175. ! context.o: context.spp magic.i $(ATRANS)
  176. ! intr.o: intr.spp magic.i $(ATRANS)
  177. ! syscall.o: syscall.spp magic.i $(ATRANS)
  178. ! quickzer.o: quickzer.spp $(ATRANS)
  179. ! quickmov.o: quickmov.spp $(ATRANS)
  180. ! cpu.o: cpu.spp $(ATRANS)
  181. ! context.o0: context.spp magic.i $(ATRANS)
  182. ! intr.o0: intr.spp magic.i $(ATRANS)
  183. ! syscall.o0: syscall.spp magic.i $(ATRANS)
  184. ! quickzer.o0: quickzer.spp $(ATRANS)
  185. ! quickmov.o0: quickmov.spp $(ATRANS)
  186. ! cpu.o0: cpu.spp $(ATRANS)
  187.   
  188.   #
  189.   # mkptypes generates prototypes from C source code. If you don't have it,
  190. --- 198,209 ----
  191.   .c.o0:
  192.       $(CC) -c $(CFLAGS030) -o$@ $<
  193.   
  194. ! context.o context.o0: context.spp magic.i $(ATRANS)
  195. ! intr.o intr.o0: intr.spp magic.i $(ATRANS)
  196. ! syscall.o syscall.o0: syscall.spp magic.i $(ATRANS)
  197. ! quickzer.o quickzer.o0: quickzer.spp $(ATRANS)
  198. ! quickmov.o quickmov.o0: quickmov.spp $(ATRANS)
  199. ! cpu.o cpu.o0: cpu.spp $(ATRANS)
  200.   
  201.   #
  202.   # mkptypes generates prototypes from C source code. If you don't have it,
  203. ***************
  204. *** 217,223 ****
  205.   #
  206.   GENFILES= $(OBJS) $(OBJS030) $(ATRANSOBJ) $(ATRANS) $(GENMAGICPRG) \
  207.       $(YTABC) $(YTABH) magic.i __asm.o genmagic.o
  208. ! EXTRAS= asmtab.c asmtab.h mint.prg mint030.prg mint.sym
  209.   
  210.   clean:
  211.       $(RM) -f $(GENFILES)
  212. --- 224,230 ----
  213.   #
  214.   GENFILES= $(OBJS) $(OBJS030) $(ATRANSOBJ) $(ATRANS) $(GENMAGICPRG) \
  215.       $(YTABC) $(YTABH) magic.i __asm.o genmagic.o
  216. ! EXTRAS= asmtab.c asmtab.h mint.prg mint030.prg mint.sym mint030.sym
  217.   
  218.   clean:
  219.       $(RM) -f $(GENFILES)
  220. *** 1.7    1993/06/25 21:14:36
  221. --- bios.c    1993/08/10 20:47:18
  222. ***************
  223. *** 253,267 ****
  224.           statdev = dev;
  225.       }
  226.   
  227. ! /* provide a 10 second time out */
  228.       if (!BCOSTAT(statdev)) {
  229. !         endtime = curtime + 10*200L;
  230. !         do {
  231.   #if 0
  232. !             yield();
  233.   #endif
  234. !         } while (!BCOSTAT(statdev) && curtime < endtime);
  235. !         if ( curtime >= endtime) return 0;
  236.       }
  237.   
  238.   /* special case: many text accelerators return a bad value from
  239. --- 253,279 ----
  240.           statdev = dev;
  241.       }
  242.   
  243. ! /* provide a 10 second time out for the printer */
  244.       if (!BCOSTAT(statdev)) {
  245. !         if (dev != PRNDEV) {
  246. !             do {
  247. !     /* BUG: Speedo GDOS isn't re-entrant; so printer output to the
  248. !      * serial port could cause problems
  249. !      */
  250. !                 yield();
  251. !             } while (!BCOSTAT(statdev));
  252. !         } else {
  253. !             endtime = curtime + 10*200L;
  254. !             do {
  255.   #if 0
  256. !     /* Speedo GDOS isn't re-entrant, so we can't give up CPU
  257. !      * time here :-(
  258. !      */
  259. !                 yield();
  260.   #endif
  261. !             } while (!BCOSTAT(statdev) && curtime < endtime);
  262. !             if ( curtime >= endtime) return 0;
  263. !         }
  264.       }
  265.   
  266.   /* special case: many text accelerators return a bad value from
  267. *** 1.7    1993/06/25 21:14:36
  268. --- biosfs.c    1993/08/16 23:10:54
  269. ***************
  270. *** 1,5 ****
  271.   /*
  272. ! Copyright 1991,1992 Eric R. Smith. All rights reserved.
  273.    */
  274.   
  275.   /* simple biosfs.c */
  276. --- 1,7 ----
  277.   /*
  278. ! Copyright 1991,1992 Eric R. Smith.
  279. ! Copyright 1993 Atari Corporation.
  280. ! All rights reserved.
  281.    */
  282.   
  283.   /* simple biosfs.c */
  284. ***************
  285. *** 39,44 ****
  286. --- 41,47 ----
  287.   static long    ARGS_ON_STACK bios_select    P_((FILEPTR *f, long p, int mode));
  288.   static void    ARGS_ON_STACK bios_unselect    P_((FILEPTR *f, long p, int mode));
  289.   static long    ARGS_ON_STACK bios_tseek    P_((FILEPTR *f, long where, int whence));
  290. + static long    ARGS_ON_STACK bios_close    P_((FILEPTR *f, int pid));
  291.   
  292.   long    ARGS_ON_STACK null_open    P_((FILEPTR *f));
  293.   long    ARGS_ON_STACK null_write    P_((FILEPTR *f, const char *buf, long bytes));
  294. ***************
  295. *** 61,67 ****
  296.   
  297.   DEVDRV bios_tdevice = {
  298.       bios_topen, bios_twrite, bios_tread, bios_tseek, bios_ioctl,
  299. !     null_datime, null_close, bios_select, bios_unselect
  300.   };
  301.   
  302.   /* device driver for BIOS devices that are not terminals */
  303. --- 64,70 ----
  304.   
  305.   DEVDRV bios_tdevice = {
  306.       bios_topen, bios_twrite, bios_tread, bios_tseek, bios_ioctl,
  307. !     null_datime, bios_close, bios_select, bios_unselect
  308.   };
  309.   
  310.   /* device driver for BIOS devices that are not terminals */
  311. ***************
  312. *** 68,74 ****
  313.   
  314.   DEVDRV bios_ndevice = {
  315.       null_open, bios_nwrite, bios_nread, null_lseek, bios_ioctl,
  316. !     null_datime, null_close, bios_select, bios_unselect
  317.   };
  318.   
  319.   DEVDRV null_device = {
  320. --- 71,77 ----
  321.   
  322.   DEVDRV bios_ndevice = {
  323.       null_open, bios_nwrite, bios_nread, null_lseek, bios_ioctl,
  324. !     null_datime, bios_close, bios_select, bios_unselect
  325.   };
  326.   
  327.   DEVDRV null_device = {
  328. ***************
  329. *** 115,120 ****
  330. --- 118,124 ----
  331.       ushort    flags;            /* flags for device open */
  332.       struct tty *tty;        /* tty structure (if appropriate) */
  333.       struct bios_file *next;
  334. +     short    lockpid;        /* owner of the lock */
  335.   };
  336.   
  337.   struct bios_file BDEV[] = {
  338. ***************
  339. *** 1022,1027 ****
  340. --- 1026,1032 ----
  341.       char *aline;
  342.       short dev;
  343.       int i;
  344. +     struct bios_file *b;
  345.   
  346.       if (mode == FIONREAD) {
  347.           if (bconstat(f->fc.aux))
  348. ***************
  349. *** 1162,1169 ****
  350.           } else {
  351.               return EINVFN;
  352.           }
  353. !     } else if ((mode >= TCURSOFF && mode <= TCURSGRATE) && (f->fc.aux == 2)) {
  354. !         return Cursconf(mode - TCURSOFF, *((short *)buf));
  355.       } else {
  356.       /* Fcntl will automatically call tty_ioctl to handle
  357.        * terminal calls that we didn't deal with
  358. --- 1167,1218 ----
  359.           } else {
  360.               return EINVFN;
  361.           }
  362. !     } else if ((mode >= TCURSOFF && mode <= TCURSSTEADY) && (f->fc.aux == 2)) {
  363. !         return Cursconf(mode - TCURSOFF, 0);
  364. !     } else if ((mode >= TCURSSRATE && mode <= TCURSGRATE) && (f->fc.aux == 2)) {
  365. !         long r;
  366. !         r = Cursconf(mode - TCURSOFF, *((short *)buf));
  367. !         if (r >= 0) {
  368. !             *(short *)buf = r;
  369. !             r = 0;
  370. !         }
  371. !         return r;
  372. !     } else if (mode == F_SETLK || mode == F_SETLKW) {
  373. !         struct flock *lck = (struct flock *)buf;
  374. !         b = (struct bios_file *)f->fc.index;
  375. !         while (b->lockpid && b->lockpid != curproc->pid) {
  376. !             if (mode == F_SETLKW && lck->l_type != F_UNLCK)
  377. !                 sleep(IO_Q, (long)b);
  378. !             else
  379. !                 return ELOCKED;
  380. !         }
  381. !         if (lck->l_type == F_UNLCK) {
  382. !             if (!(f->flags & O_LOCK)) {
  383. !                 DEBUG(("bios_ioctl: wrong file descriptor for UNLCK"));
  384. !                 return ENSLOCK;
  385. !             }
  386. !             if (b->lockpid != curproc->pid)
  387. !                 return ENSLOCK;
  388. !             b->lockpid = 0;
  389. !             f->flags &= ~O_LOCK;
  390. !             wake(IO_Q, (long)b);    /* wake anyone waiting for this lock */
  391. !         } else {
  392. !             b->lockpid = curproc->pid;
  393. !             f->flags |= O_LOCK;
  394. !         }
  395. !     } else if (mode == F_GETLK) {
  396. !         struct flock *lck = (struct flock *)buf;
  397. !         b = (struct bios_file *)f->fc.index;
  398. !         if (b->lockpid) {
  399. !             lck->l_type = F_WRLCK;
  400. !             lck->l_start = lck->l_len = 0;
  401. !             lck->l_pid = b->lockpid;
  402. !         } else {
  403. !             lck->l_type = F_UNLCK;
  404. !         }
  405.       } else {
  406.       /* Fcntl will automatically call tty_ioctl to handle
  407.        * terminal calls that we didn't deal with
  408. ***************
  409. *** 1220,1225 ****
  410. --- 1269,1288 ----
  411.           else if (mode == O_WRONLY && tty->wsel == p)
  412.               tty->wsel = 0;
  413.       }
  414. + }
  415. + static long ARGS_ON_STACK 
  416. + bios_close(f, pid)
  417. +     FILEPTR *f;
  418. +     int pid;
  419. + {
  420. +     struct bios_file *b;
  421. +     b = (struct bios_file *)f->fc.index;
  422. +     if ((f->flags & O_LOCK) && (b->lockpid == pid)) {
  423. +         b->lockpid = 0;
  424. +     }
  425. +     return 0;
  426.   }
  427.   
  428.   /*
  429. *** 1.7    1993/06/25 21:14:36
  430. --- debug.c    1993/08/13 18:41:26
  431. ***************
  432. *** 517,523 ****
  433.   }
  434.   
  435.   
  436. ! static char *rebootmsg[MAXLANG] = {
  437.   "FATAL ERROR. You must reboot the system.\r\n",
  438.   "FATALER FEHLER. Das System muß neu gestartet werden.\r\n",    /* German */
  439.   "FATAL ERROR. You must reboot the system.\r\n",        /* French */
  440. --- 517,523 ----
  441.   }
  442.   
  443.   
  444. ! static const char *rebootmsg[MAXLANG] = {
  445.   "FATAL ERROR. You must reboot the system.\r\n",
  446.   "FATALER FEHLER. Das System muß neu gestartet werden.\r\n",    /* German */
  447.   "FATAL ERROR. You must reboot the system.\r\n",        /* French */
  448. ***************
  449. *** 608,616 ****
  450.           out_device = 2;
  451.           break;
  452.       case 0x3f:        /* F5: dump memory */
  453. !         DUMPMEM(ker);
  454. !         DUMPMEM(core);
  455. !         DUMPMEM(alt);
  456.           break;
  457.       case 0x40:        /* F6: dump processes */
  458.           DUMPPROC();
  459. --- 608,617 ----
  460.           out_device = 2;
  461.           break;
  462.       case 0x3f:        /* F5: dump memory */
  463. !         DUMP_ALL_MEM();
  464. !         break;
  465. !     case 0x58:        /* shift+F5: dump kernel allocated memory */
  466. !         NALLOC_DUMP();
  467.           break;
  468.       case 0x40:        /* F6: dump processes */
  469.           DUMPPROC();
  470. *** 1.7    1993/06/25 21:14:36
  471. --- dosdir.c    1993/08/10 20:48:14
  472. ***************
  473. *** 99,110 ****
  474.       return (*dir->fs->dfree)(dir, buf);
  475.   }
  476.   
  477. - /* temp1 is a convenient place for path2fs puts the last component of
  478. -  *   the path name
  479. -  */
  480. - extern char temp1[PATH_MAX];    /* in filesys.c */
  481.   long ARGS_ON_STACK
  482.   d_create(path)
  483.       const char *path;
  484. --- 99,104 ----
  485. ***************
  486. *** 111,116 ****
  487. --- 105,111 ----
  488.   {
  489.       fcookie dir;
  490.       long r;
  491. +     char temp1[PATH_MAX];
  492.   
  493.       TRACE(("Dcreate(%s)", path));
  494.   
  495. ***************
  496. *** 140,145 ****
  497. --- 135,141 ----
  498.       PROC *p;
  499.       int i;
  500.       XATTR xattr;
  501. +     char temp1[PATH_MAX];
  502.   
  503.       TRACE(("Ddelete(%s)", path));
  504.   
  505. ***************
  506. *** 365,370 ****
  507. --- 361,367 ----
  508.       XATTR xattr;
  509.       long r;
  510.       int i, havelabel;
  511. +     char temp1[PATH_MAX];
  512.   
  513.       TRACE(("Fsfirst(%s, %x)", path, attrib));
  514.   
  515. ***************
  516. *** 567,573 ****
  517.   long ARGS_ON_STACK
  518.   f_snext()
  519.   {
  520. !     static char buf[TOS_NAMELEN+1];
  521.       DTABUF *dta = curproc->dta;
  522.       FILESYS *fs;
  523.       fcookie fc;
  524. --- 564,570 ----
  525.   long ARGS_ON_STACK
  526.   f_snext()
  527.   {
  528. !     char buf[TOS_NAMELEN+1];
  529.       DTABUF *dta = curproc->dta;
  530.       FILESYS *fs;
  531.       fcookie fc;
  532. ***************
  533. *** 684,690 ****
  534.   
  535.       TRACE(("Fattrib(%s, %d)", name, attr));
  536.   
  537. !     r = path2cookie(name, (char *)0, &fc);
  538.   
  539.       if (r) {
  540.           DEBUG(("Fattrib(%s): error %ld", name, r));
  541. --- 681,687 ----
  542.   
  543.       TRACE(("Fattrib(%s, %d)", name, attr));
  544.   
  545. !     r = path2cookie(name, follow_links, &fc);
  546.   
  547.       if (r) {
  548.           DEBUG(("Fattrib(%s): error %ld", name, r));
  549. ***************
  550. *** 727,732 ****
  551. --- 724,730 ----
  552.   {
  553.       fcookie dir;
  554.       long r;
  555. +     char temp1[PATH_MAX];
  556.   
  557.       TRACE(("Fdelete(%s)", name));
  558.   
  559. ***************
  560. *** 756,762 ****
  561.   {
  562.       fcookie olddir, newdir, oldfil;
  563.       XATTR xattr;
  564. !     char temp2[PATH_MAX];
  565.       long r;
  566.   
  567.       UNUSED(junk);
  568. --- 754,760 ----
  569.   {
  570.       fcookie olddir, newdir, oldfil;
  571.       XATTR xattr;
  572. !     char temp1[PATH_MAX], temp2[PATH_MAX];
  573.       long r;
  574.   
  575.       UNUSED(junk);
  576. ***************
  577. *** 954,961 ****
  578.       DIR *dirh = (DIR *)handle;
  579.       DIR **where;
  580.   
  581. -     if (!dirh->fc.fs)
  582. -         return EIHNDL;
  583.       where = &curproc->searches;
  584.       while (*where && *where != dirh) {
  585.           where = &((*where)->next);
  586. --- 952,957 ----
  587. ***************
  588. *** 968,976 ****
  589.   /* unlink the directory from the chain */
  590.       *where = dirh->next;
  591.   
  592. !     r = (*dirh->fc.fs->closedir)(dirh);
  593. !     release_cookie(&dirh->fc);
  594. !     dirh->fc.fs = 0;
  595.   
  596.       if (r) {
  597.           DEBUG(("Dclosedir: error %ld", r));
  598. --- 964,975 ----
  599.   /* unlink the directory from the chain */
  600.       *where = dirh->next;
  601.   
  602. !     if (dirh->fc.fs) {
  603. !         r = (*dirh->fc.fs->closedir)(dirh);
  604. !         release_cookie(&dirh->fc);
  605. !     } else {
  606. !         r = 0;
  607. !     }
  608.   
  609.       if (r) {
  610.           DEBUG(("Dclosedir: error %ld", r));
  611. ***************
  612. *** 1019,1025 ****
  613.       const char *old, *new;
  614.   {
  615.       fcookie olddir, newdir;
  616. !     char temp2[PATH_MAX];
  617.       long r;
  618.   
  619.       TRACE(("Flink(%s, %s)", old, new));
  620. --- 1018,1024 ----
  621.       const char *old, *new;
  622.   {
  623.       fcookie olddir, newdir;
  624. !     char temp1[PATH_MAX], temp2[PATH_MAX];
  625.       long r;
  626.   
  627.       TRACE(("Flink(%s, %s)", old, new));
  628. ***************
  629. *** 1066,1071 ****
  630. --- 1065,1071 ----
  631.   {
  632.       fcookie newdir;
  633.       long r;
  634. +     char temp1[PATH_MAX];
  635.   
  636.       TRACE(("Fsymlink(%s, %s)", old, new));
  637.   
  638. ***************
  639. *** 1131,1136 ****
  640. --- 1131,1137 ----
  641.   {
  642.       fcookie dir;
  643.       long r;
  644. +     char temp1[PATH_MAX];
  645.   
  646.       TRACE(("Dcntl(cmd=%x, file=%s, arg=%lx)", cmd, name, arg));
  647.   
  648. *** 1.7    1993/06/25 21:14:36
  649. --- dosfile.c    1993/08/10 20:48:20
  650. ***************
  651. *** 8,15 ****
  652.   
  653.   #include "mint.h"
  654.   
  655. - extern char temp1[];    /* see filesys.c */
  656.   static long do_dup P_((int,int));
  657.   static void unselectme P_((PROC *));
  658.   
  659. --- 8,13 ----
  660. ***************
  661. *** 33,38 ****
  662. --- 31,37 ----
  663.       XATTR xattr;
  664.       unsigned perm;
  665.       int creating;
  666. +     char temp1[PATH_MAX];
  667.       extern FILESYS proc_filesys;
  668.   
  669.   /* for special BIOS "fake" devices */
  670. ***************
  671. *** 381,386 ****
  672. --- 380,386 ----
  673.       long r;
  674.       PROC *proc;
  675.       int offset = 0;
  676. +     char temp1[PATH_MAX];
  677.   
  678.       TRACE(("Fcreate(%s, %x)", name, attrib));
  679.   #if O_GLOBAL
  680. *** 1.7    1993/06/25 21:14:36
  681. --- dosmem.c    1993/08/16 18:28:26
  682. ***************
  683. *** 13,18 ****
  684. --- 13,20 ----
  685.   
  686.   #include "mint.h"
  687.   
  688. + #define DIRSEP(c) ((c) == '\\')
  689.   int procdate, proctime;    /* set when any processes are created/destroyed */
  690.   
  691.   static long do_vfork P_((int));
  692. ***************
  693. *** 313,321 ****
  694. --- 315,325 ----
  695.       XATTR xattr;
  696.       int newpid;
  697.   
  698. + #ifdef DEBUG_INFO
  699.   /* tfmt and tail_offs are used for debugging only */
  700.       const char *tfmt = "Pexec(%d,%s,\"%s\",%lx)";
  701.       int tail_offs = 1;
  702. + #endif
  703.   
  704.   /* the high bit of mode controls process tracing */
  705.       switch(mode & 0x7fff) {
  706. ***************
  707. *** 338,345 ****
  708. --- 342,351 ----
  709.       case 4:
  710.           mkwait = mkgo = 1;
  711.           thread = (mode == 4);
  712. + #ifdef DEBUG_INFO
  713.           tfmt = "Pexec(%d,%lx,BP:%lx,%lx)";
  714.           tail_offs = 0;
  715. + #endif
  716.           break;
  717.       case 106:
  718.           mkfree = 1;        /* fall through */
  719. ***************
  720. *** 347,354 ****
  721. --- 353,362 ----
  722.           thread = (mode == 104);
  723.           mkgo = 1;
  724.           mkname = (ptr1 != 0);
  725. + #ifdef DEBUG_INFO
  726.           tfmt = "Pexec(%d,%s,BP:%lx,%lx)";
  727.           tail_offs = 0;
  728. + #endif
  729.           break;
  730.       case 206:
  731.   #if 0
  732. ***************
  733. *** 363,370 ****
  734. --- 371,380 ----
  735.       case 204:
  736.           mkgo = overlay = 1;
  737.           mkname = (ptr1 != 0);
  738. + #ifdef DEBUG_INFO
  739.           tfmt = "Pexec(%d,%s,BP:%lx,%lx)";
  740.           tail_offs = 0;
  741. + #endif
  742.           break;
  743.       case 7:
  744.           flags = (long)ptr1;    /* set program flags */
  745. ***************
  746. *** 371,378 ****
  747. --- 381,390 ----
  748.                       /* and fall through */
  749.       case 5:
  750.           mkbase = 1;
  751. + #ifdef DEBUG_INFO
  752.           tfmt = "Pexec(%d,%lx,%s,%lx)";
  753.           tail_offs = 0;
  754. + #endif
  755.           break;
  756.       default:
  757.           DEBUG(("Pexec(%d,%lx,%lx,%lx): bad mode",mode,ptr1,ptr2,ptr3));
  758. ***************
  759. *** 402,408 ****
  760.   TRACE(("creating environment"));
  761.   
  762.       if (mkload || mkbase) {
  763. !         env = create_env((char *)ptr3);
  764.           if (!env) {
  765.               DEBUG(("Pexec: unable to create environment"));
  766.               if (p) dispose_proc(p);
  767. --- 414,420 ----
  768.   TRACE(("creating environment"));
  769.   
  770.       if (mkload || mkbase) {
  771. !         env = create_env((char *)ptr3, flags);
  772.           if (!env) {
  773.               DEBUG(("Pexec: unable to create environment"));
  774.               if (p) dispose_proc(p);
  775. ***************
  776. *** 531,536 ****
  777. --- 543,571 ----
  778.               }
  779.               return mint_errno;
  780.           }
  781. +     /* jr: add Pexec information to PROC struct */
  782. +         strncpy(p->cmdlin, b->p_cmdlin, 128);
  783. +         p->fname[0] = 0;
  784. +         if (mkload) {
  785. +             char tmp[PATH_MAX];
  786. +             char *source = ptr1;
  787. +             tmp[1] = ':';
  788. +             if (source[1] == ':') {
  789. +                 tmp[0] = source[0];
  790. +                 source += 2;
  791. +             } else
  792. +                 tmp[0] = 'A' + curproc->curdrv;
  793. +             if (DIRSEP(source[0]))    /* absolute path? */
  794. +             {
  795. +                 strncpy (&tmp[2], &source[0], PATH_MAX-2);
  796. +                 strcpy (p->fname, tmp);
  797. +             } else {
  798. +                 if (! d_getcwd (&tmp[2], tmp[0] - 'A' + 1, PATH_MAX - 2))
  799. +                     ksprintf (p->fname, "%s\\%s", tmp, source);
  800. +             }
  801. +         }
  802.           if (ptrace)
  803.               p->ptracer = pid2proc(p->ppid);
  804.   
  805. ***************
  806. *** 731,739 ****
  807.   
  808.   /* close pending opendir/readdir searches */
  809.       for (dirh = curproc->searches; dirh; ) {
  810. !         if (!dirh->fc.fs) continue;
  811. !         (*dirh->fc.fs->closedir)(dirh);
  812. !         release_cookie(&dirh->fc);
  813.           nexth = dirh->next;
  814.           kfree(dirh);
  815.           dirh = nexth;
  816. --- 766,775 ----
  817.   
  818.   /* close pending opendir/readdir searches */
  819.       for (dirh = curproc->searches; dirh; ) {
  820. !         if (dirh->fc.fs) {
  821. !             (*dirh->fc.fs->closedir)(dirh);
  822. !             release_cookie(&dirh->fc);
  823. !         }
  824.           nexth = dirh->next;
  825.           kfree(dirh);
  826.           dirh = nexth;
  827. ***************
  828. *** 1099,1105 ****
  829. --- 1135,1144 ----
  830.       assert(p != curproc);
  831.   
  832.   /* take the child off both the global and ZOMBIE lists */
  833. +     { short sr = spl7();
  834.       rm_q(ZOMBIE_Q, p);
  835. +     spl(sr);
  836. +     }
  837.   
  838.       if (proclist == p) {
  839.           proclist = p->gl_next;
  840. ***************
  841. *** 1174,1180 ****
  842.       long sigmask;
  843.       MEMREGION *m, *savemem = 0;
  844.       long savesize, txtsize;
  845. !     int i;
  846.       char *saveplace;
  847.   
  848.       p = fork_proc();
  849. --- 1213,1219 ----
  850.       long sigmask;
  851.       MEMREGION *m, *savemem = 0;
  852.       long savesize, txtsize;
  853. !     int i, newpid;
  854.       char *saveplace;
  855.   
  856.       p = fork_proc();
  857. ***************
  858. *** 1277,1284 ****
  859.           detach_region(curproc, savemem);
  860.       }
  861.       curproc->sigmask = sigmask;
  862.       check_sigs();    /* did we get any signals while sleeping? */
  863. !     return p->pid;
  864.   }
  865.   
  866.   /*
  867. --- 1316,1327 ----
  868.           detach_region(curproc, savemem);
  869.       }
  870.       curproc->sigmask = sigmask;
  871. + /* note that the PROC structure pointed to by p may be freed during
  872. +  * the check_sigs call!
  873. +  */
  874. +     newpid = p->pid;
  875.       check_sigs();    /* did we get any signals while sleeping? */
  876. !     return newpid;
  877.   }
  878.   
  879.   /*
  880. *** 1.7    1993/06/25 21:14:36
  881. --- filesys.c    1993/08/10 20:48:52
  882. ***************
  883. *** 121,132 ****
  884.    * processes are run
  885.    *
  886.    * NOTE that a number of directory changes take place here: we look first
  887. !  * in the current directory, then in the directory \mint, and finally
  888. !  * the d_lock() calls force us into the root directory.
  889.    */
  890.   
  891.   typedef FILESYS * ARGS_ON_STACK (*FSFUNC) P_((struct kerinfo *));
  892.   
  893.   void
  894.   load_filesys()
  895.   {
  896. --- 121,138 ----
  897.    * processes are run
  898.    *
  899.    * NOTE that a number of directory changes take place here: we look first
  900. !  * in the current directory, then in the directory \mint.
  901.    */
  902.   
  903.   typedef FILESYS * ARGS_ON_STACK (*FSFUNC) P_((struct kerinfo *));
  904.   
  905. + /* uk: made this lie outside of functions, as load_filesys() and
  906. +  *     load_devdriver() need access to it.
  907. +  */
  908. + #define NPATHS 3
  909. + static const char *ext_paths[NPATHS] = {"", "\\MINT", "\\MULTITOS"};
  910.   void
  911.   load_filesys()
  912.   {
  913. ***************
  914. *** 139,157 ****
  915.       extern struct kerinfo kernelinfo; /* in main.c */
  916.       char curpath[PATH_MAX];
  917.       MEMREGION *xfsreg;
  918. - #define NPATHS 3
  919. -     static const char *paths[NPATHS] = {"", "\\MINT", "\\MULTITOS"};
  920.   
  921.       curproc->dta = &dta;
  922.       d_getpath(curpath,0);
  923.   
  924.       for (i = 0; i < NPATHS; i++) {
  925. !         if (*paths[i]) {
  926.   /* don't bother checking the current directory twice! */
  927. !             if (!stricmp(paths[i],curpath))
  928.               r = -1;
  929.               else
  930. !             r = d_setpath(paths[i]);
  931.           }
  932.           else
  933.               r = 0;
  934. --- 145,161 ----
  935.       extern struct kerinfo kernelinfo; /* in main.c */
  936.       char curpath[PATH_MAX];
  937.       MEMREGION *xfsreg;
  938.   
  939.       curproc->dta = &dta;
  940.       d_getpath(curpath,0);
  941.   
  942.       for (i = 0; i < NPATHS; i++) {
  943. !         if (*ext_paths[i]) {
  944.   /* don't bother checking the current directory twice! */
  945. !             if (!stricmp(ext_paths[i],curpath))
  946.               r = -1;
  947.               else
  948. !             r = d_setpath(ext_paths[i]);
  949.           }
  950.           else
  951.               r = 0;
  952. ***************
  953. *** 177,185 ****
  954.       /* put the loaded XFS into super accesible memory */
  955.               xfsreg = addr2region( (long) b );
  956.               mark_region(xfsreg, PROT_S);
  957.       /* link it into the list of drivers */
  958. !             fs->next = active_fs;
  959. !             active_fs = fs;
  960.           } else {
  961.               DEBUG(("%s returned null", dta.dta_name));
  962.               m_free((virtaddr)b);
  963. --- 181,209 ----
  964.       /* put the loaded XFS into super accesible memory */
  965.               xfsreg = addr2region( (long) b );
  966.               mark_region(xfsreg, PROT_S);
  967.       /* link it into the list of drivers */
  968. !     /* uk: but only if it has not installed itself via Dcntl()
  969. !      *     after checking if file system is already installed,
  970. !      *     so we know for sure that each file system in at most
  971. !      *     once in the chain (important for removal!)
  972. !      * also note: this doesn't preclude loading two different
  973. !      * instances of the same file system driver, e.g. it's perfectly
  974. !      * OK to have a "cdromy1.xfs" and "cdromz2.xfs"; the check below
  975. !      * just makes sure that a given instance of a file system is
  976. !      * installed at most once. I.e., it prevents cdromy1.xfs from being
  977. !      * installed twice.
  978. !      */
  979. !             if ((FILESYS*)1L != fs) {
  980. !                 FILESYS *f = active_fs;
  981. !                 for (;  f;  f = f->next)
  982. !                     if (f == fs)
  983. !                         break;
  984. !                 if (!f) {   /* we ran completly through the list */
  985. !                     fs->next = active_fs;
  986. !                     active_fs = fs;
  987. !                 }
  988. !             }
  989.           } else {
  990.               DEBUG(("%s returned null", dta.dta_name));
  991.               m_free((virtaddr)b);
  992. ***************
  993. *** 201,206 ****
  994. --- 225,334 ----
  995.   #endif
  996.   }
  997.   
  998. + /*
  999. +  * uk: load device driver in files called *.xdd (external device driver)
  1000. +  *     from disk
  1001. +  * maybe this should go into biosfs.c ??
  1002. +  *
  1003. +  * this routine is called after process 0 is set up, but before any user
  1004. +  * processes are run, but before the loadable file systems come in,
  1005. +  * so they can make use of external device drivers
  1006. +  *
  1007. +  * NOTE that a number of directory changes take place here: we look first
  1008. +  * in the current directory, then in the directory \mint, and finally
  1009. +  * the d_lock() calls force us into the root directory.
  1010. +  * ??? what d_lock() calls ???
  1011. +  */
  1012. + typedef DEVDRV * ARGS_ON_STACK (*DEVFUNC) P_((struct kerinfo *));
  1013. + #define DEV_SELFINST  ((DEVDRV*)1L)  /* dev driver did dcntl() already */
  1014. + void
  1015. + load_devdriver()
  1016. + {
  1017. +     long r;
  1018. +     BASEPAGE *b;
  1019. +     DEVDRV *dev;
  1020. +     DEVFUNC initf;
  1021. +     struct dev_descr the_dev;
  1022. +     static DTABUF dta;
  1023. +     int i;
  1024. +     extern struct kerinfo kernelinfo; /* in main.c */
  1025. +     char curpath[PATH_MAX];
  1026. +     char dev_name[PATH_MAX];  /* a bit long, but one never knows... */
  1027. +     char ch, *p;
  1028. +     MEMREGION *xddreg;
  1029. +     curproc->dta = &dta;
  1030. +     d_getpath(curpath,0);
  1031. +     for (i = 0; i < NPATHS; i++) {
  1032. +         if (*ext_paths[i]) {
  1033. + /* don't bother checking the current directory twice! */
  1034. +             if (!stricmp(ext_paths[i],curpath))
  1035. +             r = -1;
  1036. +             else
  1037. +             r = d_setpath(ext_paths[i]);
  1038. +         }
  1039. +         else
  1040. +             r = 0;
  1041. +         if (r == 0)
  1042. +             r = f_sfirst("*.xdd", 0);
  1043. +         while (r == 0) {
  1044. +         b = (BASEPAGE *)p_exec(3, dta.dta_name, (char *)"", (char *)0);
  1045. +         if ( ((long)b) < 0 ) {
  1046. +             DEBUG(("Error loading device driver %s", dta.dta_name));
  1047. +             r = f_snext();
  1048. +             continue;
  1049. +         }
  1050. +     /* we leave a little bit of slop at the end of the loaded stuff */
  1051. +         m_shrink(0, (virtaddr)b, 512 + b->p_tlen + b->p_dlen + b->p_blen);
  1052. +         initf = (DEVFUNC)b->p_tbase;
  1053. +         TRACE(("initializing %s", dta.dta_name));
  1054. +         dev = (*initf)(&kernelinfo);
  1055. +         if (dev) {
  1056. +             if (DEV_SELFINST != dev) {
  1057. +     /* we need to install the device driver ourselves */
  1058. +                 the_dev.driver = dev;
  1059. +                 the_dev.dinfo = 0;
  1060. +                 the_dev.flags = 0;
  1061. +                 the_dev.tty = (struct tty*)0L;
  1062. +                 the_dev.reserved[0] = the_dev.reserved[1] = 0;
  1063. +                 the_dev.reserved[2] = the_dev.reserved[3] = 0;
  1064. +                 p = dta.dta_name;
  1065. +                 while (*p && *p != '.') p++;
  1066. +                 ch = *p;
  1067. +                 *p = '\0';  /* we dont want the extension */
  1068. +                 strcpy(dev_name, "u:\\dev\\");
  1069. +                 strcat(dev_name, dta.dta_name);
  1070. +                 *p = ch;
  1071. +                 r = d_cntl(DEV_INSTALL, dev_name, (long)&the_dev);
  1072. +                 if (r <= 0) {
  1073. +                     DEBUG(("Error installing device driver %s", dta.dta_name));
  1074. +                     r = f_snext();
  1075. +                     continue;
  1076. +                 }
  1077. +             }
  1078. +             TRACE(("%s loaded OK", dta.dta_name));
  1079. +     /* put the loaded XDD into super accesible memory */
  1080. +             xddreg = addr2region( (long) b );
  1081. +             mark_region(xddreg, PROT_S);
  1082. +         } else {
  1083. +             DEBUG(("%s returned null", dta.dta_name));
  1084. +             m_free((virtaddr)b);
  1085. +         }
  1086. +         r = f_snext();
  1087. +         }
  1088. +     }
  1089. + }
  1090. +  
  1091.   void
  1092.   close_filesys()
  1093.   {
  1094. ***************
  1095. *** 285,294 ****
  1096.           }
  1097.   
  1098.       /* terminate any active directory searches on the drive */
  1099. -     /* BUG: This handles only Fsfirst/Fsnext searches! */
  1100.           for (i = 0; i < NUM_SEARCH; i++) {
  1101.               dirh = &p->srchdir[i];
  1102. !             if (dirh->fc.fs && dirh->fc.dev == d) {
  1103.                   TRACE(("closing search for process %d", p->pid));
  1104.                   release_cookie(&dirh->fc);
  1105.                   dirh->fc.fs = 0;
  1106. --- 413,421 ----
  1107.           }
  1108.   
  1109.       /* terminate any active directory searches on the drive */
  1110.           for (i = 0; i < NUM_SEARCH; i++) {
  1111.               dirh = &p->srchdir[i];
  1112. !             if (p->srchdta[i] && dirh->fc.fs && dirh->fc.dev == d) {
  1113.                   TRACE(("closing search for process %d", p->pid));
  1114.                   release_cookie(&dirh->fc);
  1115.                   dirh->fc.fs = 0;
  1116. ***************
  1117. *** 296,301 ****
  1118. --- 423,438 ----
  1119.               }
  1120.           }
  1121.   
  1122. +         for (dirh = p->searches; dirh; dirh = dirh->next) {
  1123. +             /* If this search is on the changed drive, release
  1124. +                the cookie, but do *not* free it, since the
  1125. +                user could later call closedir on it. */
  1126. +             if (dirh->fc.fs && dirh->fc.dev == d) {
  1127. +                 release_cookie (&dirh->fc);
  1128. +                 dirh->fc.fs = 0;
  1129. +             }
  1130. +         }
  1131. +             
  1132.           if (d >= NUM_DRIVES) continue;
  1133.   
  1134.       /* change any active directories on the device to the (new) root */
  1135. ***************
  1136. *** 400,407 ****
  1137.   /*
  1138.    * routines for parsing path names
  1139.    */
  1140. - char temp1[PATH_MAX];    /* temporary storage for file names */
  1141.   
  1142.   #define DIRSEP(p) ((p) == '\\')
  1143.   
  1144. --- 537,542 ----
  1145. *** 1.7    1993/06/25 21:14:36
  1146. --- main.c    1993/08/10 20:49:14
  1147. ***************
  1148. *** 212,218 ****
  1149.   /*C*/    8,    /* CPU32 bus error */
  1150.   /*D*/    0,    /* NOTUSED */
  1151.   /*E*/    0,    /* NOTUSED */
  1152. ! /*F*/    0    /* NOTUSED */
  1153.   };
  1154.   
  1155.   /* TOS and MiNT cookie jars, respectively. See the comments and code 
  1156. --- 212,218 ----
  1157.   /*C*/    8,    /* CPU32 bus error */
  1158.   /*D*/    0,    /* NOTUSED */
  1159.   /*E*/    0,    /* NOTUSED */
  1160. ! /*F*/    13    /* 68070 and 9xC1xx microcontroller address error */
  1161.   };
  1162.   
  1163.   /* TOS and MiNT cookie jars, respectively. See the comments and code 
  1164. ***************
  1165. *** 265,286 ****
  1166.   do_exec_os(basepage)
  1167.       register long basepage;
  1168.   {
  1169. !     register int r;
  1170.   
  1171. !     if (!init_prg)
  1172. !         init_prg = "\\multitos\\gem.sys";
  1173.   
  1174.   /* we have to set a7 to point to lower in our TPA; otherwise we would
  1175.    * bus error right after the Mshrink call!
  1176.    */
  1177. !     setstack(basepage+500L);
  1178.   #if defined(__TURBOC__) && !defined(__MINT__)
  1179. !     Mshrink(0, (void *)basepage, 512L);
  1180.   #else
  1181. !     Mshrink((void *)basepage, 512L);
  1182.   #endif
  1183. !     r = (int) Pexec(200, (char *)init_prg, init_tail, init_env);
  1184. !     Pterm(r);
  1185.   }
  1186.   
  1187.   
  1188. --- 265,292 ----
  1189.   do_exec_os(basepage)
  1190.       register long basepage;
  1191.   {
  1192. !     register long r;
  1193.   
  1194. ! /* if the user didn't specify a startup program, jump to the ROM */
  1195. !     if (!init_prg) {
  1196. !         register void ARGS_ON_STACK (*f) P_((long));
  1197. !         f = (void ARGS_ON_STACK (*) P_((long))) old_execos.next;
  1198. !         (*f)(basepage);
  1199. !         Pterm0();
  1200. !     } else {        
  1201.   
  1202.   /* we have to set a7 to point to lower in our TPA; otherwise we would
  1203.    * bus error right after the Mshrink call!
  1204.    */
  1205. !         setstack(basepage+500L);
  1206.   #if defined(__TURBOC__) && !defined(__MINT__)
  1207. !         Mshrink(0, (void *)basepage, 512L);
  1208.   #else
  1209. !         Mshrink((void *)basepage, 512L);
  1210.   #endif
  1211. !         r = Pexec(200, (char *)init_prg, init_tail, init_env);
  1212. !         Pterm((int)r);
  1213. !     }
  1214.   }
  1215.   
  1216.   
  1217. ***************
  1218. *** 816,821 ****
  1219. --- 822,829 ----
  1220.    */
  1221.       (void)d_setpath(curpath);
  1222.       
  1223. +     load_devdriver();
  1224.   #ifndef PROFILING
  1225.   /* load_filesys causes media changes :-( */
  1226.       load_filesys();
  1227. ***************
  1228. *** 866,872 ****
  1229.           r = p_exec(0, (char *)init_prg, init_tail, init_env);
  1230.       } else if (!gem_active) {   
  1231.           BASEPAGE *bp; int pid;
  1232. !         bp = (BASEPAGE *)p_exec(7, (char *)7L, (char *)"\0", init_env);
  1233.           bp->p_tbase = *((long *) EXEC_OS );
  1234.           r = p_exec(106, (char *)"GEM", bp, 0L);
  1235.           pid = (int)r;
  1236. --- 874,882 ----
  1237.           r = p_exec(0, (char *)init_prg, init_tail, init_env);
  1238.       } else if (!gem_active) {   
  1239.           BASEPAGE *bp; int pid;
  1240. !         bp = (BASEPAGE *)p_exec(7,
  1241. !           (char *)((long)F_FASTLOAD | F_ALTLOAD | F_ALTALLOC | F_PROT_S),
  1242. !           (char *)"\0", init_env);
  1243.           bp->p_tbase = *((long *) EXEC_OS );
  1244.           r = p_exec(106, (char *)"GEM", bp, 0L);
  1245.           pid = (int)r;
  1246. ***************
  1247. *** 1039,1045 ****
  1248.                       if (jar->value != 30) no_mem_prot = 1;
  1249.                       foundcpu = 1;
  1250.               } else if (!strncmp(jar->tag.aschar, "_VDO",4)) {
  1251. !                 FalconVideo = (jar->value == 0x00000300L);
  1252.                   if (jar->value & 0xffff0000L)
  1253.                       screen_boundary = 15;
  1254.               } else if (!strncmp(jar->tag.aschar, "MiNT",4)) {
  1255. --- 1049,1055 ----
  1256.                       if (jar->value != 30) no_mem_prot = 1;
  1257.                       foundcpu = 1;
  1258.               } else if (!strncmp(jar->tag.aschar, "_VDO",4)) {
  1259. !                 FalconVideo = (jar->value == 0x00030000L);
  1260.                   if (jar->value & 0xffff0000L)
  1261.                       screen_boundary = 15;
  1262.               } else if (!strncmp(jar->tag.aschar, "MiNT",4)) {
  1263. ***************
  1264. *** 1131,1136 ****
  1265. --- 1141,1147 ----
  1266.       if (!strcmp(name, "INIT")) {
  1267.           init_is_gem = 0;
  1268.   setup_init:
  1269. +         if (!*val) return;
  1270.           t = kmalloc(strlen(val)+1);
  1271.           if (!t) return;
  1272.           strcpy(t, val);
  1273. *** 1.7    1993/06/25 21:14:36
  1274. --- mem.c    1993/08/13 18:11:30
  1275. ***************
  1276. *** 33,46 ****
  1277.    */
  1278.   
  1279.   /* initial number of memory regions */
  1280. ! #define NREGIONS 512
  1281.   
  1282.   /* number of new regions to allocate when the initial ones are used up */
  1283. ! #define NEWREGIONS 256
  1284.   
  1285.   static MEMREGION use_regions[NREGIONS+1];
  1286.   MEMREGION *rfreelist;
  1287.   
  1288.   /* these variables are set in init_core(), and used in
  1289.    * init_mem()
  1290.    */
  1291. --- 33,51 ----
  1292.    */
  1293.   
  1294.   /* initial number of memory regions */
  1295. ! #define NREGIONS ((8*1024)/sizeof(MEMREGION))
  1296.   
  1297.   /* number of new regions to allocate when the initial ones are used up */
  1298. ! #define NEWREGIONS ((8*1024)/sizeof(MEMREGION))
  1299.   
  1300.   static MEMREGION use_regions[NREGIONS+1];
  1301.   MEMREGION *rfreelist;
  1302.   
  1303. + /* variable for debugging purposes; number of times we've needed
  1304. +  * to get new regions
  1305. +  */
  1306. + int num_reg_requests = 0;
  1307.   /* these variables are set in init_core(), and used in
  1308.    * init_mem()
  1309.    */
  1310. ***************
  1311. *** 342,347 ****
  1312. --- 347,353 ----
  1313.               newstuff = get_region(core, NEWREGIONS*SIZEOF(MEMREGION), PROT_S);
  1314.           newfrees = newstuff ? (MEMREGION *)newstuff->loc : 0;
  1315.           if (newfrees) {
  1316. +             num_reg_requests++;
  1317.               newfrees[NEWREGIONS-1].next = 0;
  1318.               newfrees[NEWREGIONS-1].links = 0;
  1319.               for (i = 0; i < NEWREGIONS-1; i++) {
  1320. ***************
  1321. *** 885,892 ****
  1322.    */
  1323.   
  1324.   MEMREGION *
  1325. ! create_env(env)
  1326.       const char *env;
  1327.   {
  1328.       long size;
  1329.       MEMREGION *m;
  1330. --- 891,899 ----
  1331.    */
  1332.   
  1333.   MEMREGION *
  1334. ! create_env(env, flags)
  1335.       const char *env;
  1336. +     ulong flags;
  1337.   {
  1338.       long size;
  1339.       MEMREGION *m;
  1340. ***************
  1341. *** 893,898 ****
  1342. --- 900,906 ----
  1343.       virtaddr v;
  1344.       const char *old;
  1345.       char *new;
  1346. +     short protmode;
  1347.   
  1348.       if (!env) {
  1349.           env = ((BASEPAGE *)curproc->base)->p_env;
  1350. ***************
  1351. *** 903,912 ****
  1352.       while (*env || *(env+1))
  1353.           env++,size++;
  1354.   
  1355. !     v = alloc_region(core, size, PROT_P);
  1356.       /* if core fails, try alt */
  1357.       if (!v)
  1358. !         v = alloc_region(alt, size, PROT_P);
  1359.   
  1360.       if (!v) {
  1361.           DEBUG(("create_env: alloc_region failed"));
  1362. --- 911,922 ----
  1363.       while (*env || *(env+1))
  1364.           env++,size++;
  1365.   
  1366. !     protmode = (flags & F_PROTMODE) >> F_PROTSHIFT;
  1367. !     v = alloc_region(core, size, protmode);
  1368.       /* if core fails, try alt */
  1369.       if (!v)
  1370. !         v = alloc_region(alt, size, protmode);
  1371.   
  1372.       if (!v) {
  1373.           DEBUG(("create_env: alloc_region failed"));
  1374. ***************
  1375. *** 1605,1613 ****
  1376. --- 1615,1626 ----
  1377.   void
  1378.   DUMP_ALL_MEM()
  1379.   {
  1380. + #ifdef DEBUG_INFO
  1381.       DUMPMEM(ker);
  1382.       DUMPMEM(core);
  1383.       DUMPMEM(alt);
  1384. +     FORCE("new memory region descriptor pages: %d", num_reg_requests);
  1385. + #endif
  1386.   }
  1387.   
  1388.   void
  1389. *** 1.7    1993/06/25 21:14:36
  1390. --- memprot.c    1993/08/10 20:49:44
  1391. ***************
  1392. *** 495,501 ****
  1393.       ushort dt_val, s_val, wp_val;
  1394.       PROC *proc;
  1395.       MEMREGION **mr;
  1396. -     int change;
  1397.   
  1398.       if (no_mem_prot) return;
  1399.   
  1400. --- 495,500 ----
  1401. ***************
  1402. *** 505,515 ****
  1403.       mode = global_mode_table[(start >> 13)];
  1404.       }
  1405.   
  1406. -     if (global_mode_table[(start >> 13)] == mode) {
  1407. -         change = 0;
  1408. -     }
  1409. -     else change = 1;
  1410.       /* mark the global page table */
  1411.   
  1412.       memset(&global_mode_table[start >> 13],mode,(len >> 13));
  1413. --- 504,509 ----
  1414. ***************
  1415. *** 939,946 ****
  1416.   void
  1417.   report_buserr()
  1418.   {
  1419. !     long_desc *tbl;
  1420. !     const char *vmsg = NULL;
  1421.       short mode;
  1422.       ulong aa, pc;
  1423.       char alertbuf[5*32+16];    /* enough for an alert */
  1424. --- 933,939 ----
  1425.   void
  1426.   report_buserr()
  1427.   {
  1428. !     const char *vmsg;
  1429.       short mode;
  1430.       ulong aa, pc;
  1431.       char alertbuf[5*32+16];    /* enough for an alert */
  1432. ***************
  1433. *** 948,954 ****
  1434.   
  1435.       if (no_mem_prot) return;
  1436.   
  1437. -     tbl = (long_desc *)curproc->exception_tbl;
  1438.       aa = curproc->exception_addr;
  1439.       pc = curproc->exception_pc;
  1440.       if ((mint_top_tt && aa < mint_top_tt) || (aa < mint_top_st)) {
  1441. --- 941,946 ----
  1442. ***************
  1443. *** 1031,1037 ****
  1444.       MEMREGION *mp, **mr, **map;
  1445.       PROC *p;
  1446.       ulong loc;
  1447. !     short owner = 0;
  1448.       short i;
  1449.       short first;
  1450.   
  1451. --- 1023,1029 ----
  1452.       MEMREGION *mp, **mr, **map;
  1453.       PROC *p;
  1454.       ulong loc;
  1455. !     short owner;
  1456.       short i;
  1457.       short first;
  1458.   
  1459. *** 1.7    1993/06/25 21:14:36
  1460. --- nalloc2.c    1993/08/13 20:36:48
  1461. ***************
  1462. *** 1,5 ****
  1463.   /*
  1464. !  * Copyright 1992 Atari Corporation. All rights reserved.
  1465.    */
  1466.   
  1467.   /*
  1468. --- 1,6 ----
  1469.   /*
  1470. !  * Copyright 1992,1993 Atari Corporation.
  1471. !  * All rights reserved.
  1472.    */
  1473.   
  1474.   /*
  1475. ***************
  1476. *** 65,75 ****
  1477.   void *start;
  1478.   long len;
  1479.   {
  1480. !     struct arena *a = start;
  1481.       struct block *b;
  1482.   
  1483. !     a->a_next = a_first;
  1484. !     a_first = a;
  1485.       a->a_ffirst = b = (struct block *)(a+1);
  1486.       a->a_size = len;
  1487.       b->b_next = NULL;
  1488. --- 66,82 ----
  1489.   void *start;
  1490.   long len;
  1491.   {
  1492. !     struct arena *a;
  1493.       struct block *b;
  1494.   
  1495. !     for (a = a_first; a && a->a_next; a = a->a_next)
  1496. !     continue;
  1497. !     if (a)
  1498. !         a->a_next = (struct arena *)start;
  1499. !     else
  1500. !         a_first = (struct arena *)start;
  1501. !     a = start;
  1502. !     a->a_next = NULL;
  1503.       a->a_ffirst = b = (struct block *)(a+1);
  1504.       a->a_size = len;
  1505.       b->b_next = NULL;
  1506. ***************
  1507. *** 230,244 ****
  1508.       fb->b_next = b->b_next;
  1509.       }
  1510.   
  1511. - #if 0
  1512.       /* if, after coalescing, this arena is entirely free, Mfree it! */
  1513. !     if (a->a_ffirst == a+1 && 
  1514.           (a->a_ffirst->b_size + sizeof(struct block)) == a->a_size) {
  1515.           NALLOC_DEBUG('!');
  1516.           *qa = a->a_next;
  1517.           (void)Mfree(a);
  1518. -     }
  1519.   #endif
  1520.   
  1521.       return;
  1522.   }
  1523. --- 237,253 ----
  1524.       fb->b_next = b->b_next;
  1525.       }
  1526.   
  1527.       /* if, after coalescing, this arena is entirely free, Mfree it! */
  1528. !     if ((struct arena *)a->a_ffirst == a+1 && 
  1529.           (a->a_ffirst->b_size + sizeof(struct block)) == a->a_size) {
  1530.           NALLOC_DEBUG('!');
  1531.           *qa = a->a_next;
  1532. + #if 1
  1533. +         kfree(a);    /* MiNT -- give back so it can be used by users */
  1534. + #else
  1535.           (void)Mfree(a);
  1536.   #endif
  1537. +     }
  1538.   
  1539.       return;
  1540.   }
  1541. *** 1.7    1993/06/25 21:14:36
  1542. --- proc.c    1993/08/13 22:46:50
  1543. ***************
  1544. *** 1,6 ****
  1545.   /*
  1546.   Copyright 1990,1991,1992 Eric R. Smith.
  1547. ! Copyright 1992 Atari Corporation.
  1548.   All rights reserved.
  1549.   */
  1550.   
  1551. --- 1,6 ----
  1552.   /*
  1553.   Copyright 1990,1991,1992 Eric R. Smith.
  1554. ! Copyright 1992,1993 Atari Corporation.
  1555.   All rights reserved.
  1556.   */
  1557.   
  1558. ***************
  1559. *** 139,146 ****
  1560. --- 139,151 ----
  1561.           dup_cookie(&p->curdir[i], &curproc->curdir[i]);
  1562.       }
  1563.   
  1564. + /* jr: copy ploadinfo */
  1565. +     strcpy (p->cmdlin, curproc->cmdlin);
  1566. +     strcpy (p->fname, curproc->fname);
  1567.   /* clear directory search info */
  1568.       zero((char *)p->srchdta, NUM_SEARCH * SIZEOF(DTABUF *));
  1569. +     zero((char *)p->srchdir, SIZEOF(p->srchdir));
  1570.       p->searches = 0;
  1571.   
  1572.   /* copy memory */
  1573. ***************
  1574. *** 454,461 ****
  1575. --- 459,468 ----
  1576.       PROC *p;
  1577.       short sr;
  1578.       extern short kintr;    /* in bios.c */
  1579. + #ifndef MULTITOS
  1580.   #ifdef FASTTEXT
  1581.       extern int hardscroll;    /* in fasttext.c */
  1582. + #endif
  1583.   #endif
  1584.   
  1585.   /*
  1586. *** 1.7    1993/06/25 21:14:36
  1587. --- procfs.c    1993/08/13 22:49:58
  1588. ***************
  1589. *** 544,549 ****
  1590. --- 544,550 ----
  1591.    * PTRACEFLOW: restart the process (T1=0/T0=1)
  1592.    * PTRACESTEP: restart the process (T1=1/T0=0)
  1593.    * PTRACE11: restart the process (T1=1/T0=1)
  1594. +  * PLOADINFO: get information about the process name and command line
  1595.    */
  1596.   
  1597.   static long ARGS_ON_STACK 
  1598. ***************
  1599. *** 552,557 ****
  1600. --- 553,559 ----
  1601.   {
  1602.       PROC *p;
  1603.       extern long mcpu;    /* in main.c */
  1604. +     short sr;
  1605.   
  1606.       p = (PROC *)f->devinfo;
  1607.       switch(mode) {
  1608. ***************
  1609. *** 633,638 ****
  1610. --- 635,644 ----
  1611.               DEBUG(("proc_ioctl(PTRACE): process stopped by job control"));
  1612.               return EACCDN;
  1613.           }
  1614. +         if (buf && *(ushort *)buf >= NSIG) {
  1615. +             DEBUG(("proc_ioctl(PTRACE): illegal signal number"));
  1616. +             return ERANGE;
  1617. +         }
  1618.           p->ctxt[SYSCALL].sr &= 0x3fff;    /* clear both trace bits */
  1619.           p->ctxt[SYSCALL].sr |= (mode - PTRACEGO) << 14;
  1620.           p->sigpending = 0;
  1621. ***************
  1622. *** 649,657 ****
  1623. --- 655,679 ----
  1624.   TRACE(("PTRACEGO: no signal"));
  1625.           }
  1626.   /* wake the process up */
  1627. +         sr = spl7();
  1628.           rm_q(p->wait_q, p);
  1629.           add_q(READY_Q, p);
  1630. +         spl(sr);
  1631. +         return 0;
  1632. +     /* jr: PLOADINFO returns information about params passed to Pexec */
  1633. +     case PLOADINFO:
  1634. +         {
  1635. +             struct ploadinfo *pl = buf;
  1636. +             if (!p->fname[0]) return EFILNF;
  1637. +             strncpy (pl->cmdlin, p->cmdlin, 128);
  1638. +             if (strlen (p->fname) <= pl->fnamelen)
  1639. +                 strcpy (pl->fname, p->fname);
  1640. +             else
  1641. +                 return ENAMETOOLONG;
  1642. +         }
  1643.           return 0;
  1644.       case FIONREAD:
  1645.       case FIONWRITE:
  1646.           *((long *)buf) = 1L;    /* we're always ready for i/o */
  1647. *** 1.7    1993/06/25 21:14:36
  1648. --- signal.c    1993/08/10 20:50:50
  1649. ***************
  1650. *** 86,91 ****
  1651. --- 86,93 ----
  1652.   /* otherwise, make sure the process is awake */
  1653.       if (p->wait_q && p->wait_q != READY_Q) {
  1654.           short sr = spl7();
  1655. +         if (p->wait_q == SELECT_Q)
  1656. +             p->wait_cond = 0;
  1657.           rm_q(p->wait_q, p);
  1658.           add_q(READY_Q, p);
  1659.           spl(sr);
  1660. *** 1.7    1993/06/25 21:14:36
  1661. --- trutil.c    1993/08/10 20:51:22
  1662. ***************
  1663. *** 6,11 ****
  1664. --- 6,12 ----
  1665.   #define CMDSYM '%'
  1666.   
  1667.   FILE *infile, *outfile;
  1668. + extern YYSTYPE yylval;
  1669.   
  1670.   #define MAXNEST 10
  1671.   int hidecnt = 0;
  1672. *** 1.7    1993/06/25 21:14:36
  1673. --- unifs.c    1993/08/10 20:51:36
  1674. ***************
  1675. *** 1,6 ****
  1676.   /*
  1677.   Copyright 1991,1992 Eric R. Smith.
  1678. ! Copyright 1992 Atari Corporation.
  1679.   All rights reserved.
  1680.    */
  1681.   
  1682. --- 1,6 ----
  1683.   /*
  1684.   Copyright 1991,1992 Eric R. Smith.
  1685. ! Copyright 1992,1993 Atari Corporation.
  1686.   All rights reserved.
  1687.    */
  1688.   
  1689. ***************
  1690. *** 32,37 ****
  1691. --- 32,38 ----
  1692.   static DEVDRV *    ARGS_ON_STACK uni_getdev    P_((fcookie *fc, long *devsp));
  1693.   static long    ARGS_ON_STACK uni_symlink    P_((fcookie *dir, const char *name, const char *to));
  1694.   static long    ARGS_ON_STACK uni_readlink    P_((fcookie *fc, char *buf, int buflen));
  1695. + static long    ARGS_ON_STACK uni_fscntl    P_((fcookie *dir, const char *name, int cmd, long arg));
  1696.   
  1697.   FILESYS uni_filesys = {
  1698.       (FILESYS *)0,
  1699. ***************
  1700. *** 42,48 ****
  1701.       nomkdir, uni_rmdir, uni_remove, uni_getname, uni_rename,
  1702.       uni_opendir, uni_readdir, uni_rewinddir, uni_closedir,
  1703.       uni_pathconf, uni_dfree, nowritelabel, noreadlabel,
  1704. !     uni_symlink, uni_readlink, nohardlink, nofscntl, nodskchng
  1705.   };
  1706.   
  1707.   /*
  1708. --- 43,49 ----
  1709.       nomkdir, uni_rmdir, uni_remove, uni_getname, uni_rename,
  1710.       uni_opendir, uni_readdir, uni_rewinddir, uni_closedir,
  1711.       uni_pathconf, uni_dfree, nowritelabel, noreadlabel,
  1712. !     uni_symlink, uni_readlink, nohardlink, uni_fscntl, nodskchng
  1713.   };
  1714.   
  1715.   /*
  1716. ***************
  1717. *** 614,617 ****
  1718. --- 615,777 ----
  1719.       if (strlen(u->data) >= buflen)
  1720.           return ENAMETOOLONG;
  1721.       return 0;
  1722. + }
  1723. + /* uk: use these Dcntl's to install a new filesystem which is only visible
  1724. +  *     on drive u:
  1725. +  *
  1726. +  *     FS_INSTALL:   let the kernel know about the file system; it does NOT
  1727. +  *                   get a device number.
  1728. +  *     FS_MOUNT:     use Dcntl(FS_MOUNT, "u:\\foo", &descr) to make a directory
  1729. +  *                   foo where the filesytem resides in; the file system now
  1730. +  *                   gets its device number which is also written into the
  1731. +  *                   dev_no field of the fs_descr structure.
  1732. +  *     FS_UNMOUNT:   remove a file system's directory; this call closes all
  1733. +  *                   open files, directory searches and directories on this
  1734. +  *                   device. Make sure that the FS will not recognise any
  1735. +  *                   accesses to this device, as fs->root will be called
  1736. +  *                   during the reinitalisation!
  1737. +  *     FS_UNINSTALL: remove a file system completely from the kernel list,
  1738. +  *                   but that will only be possible if there is no directory
  1739. +  *                   associated with this file system.
  1740. +  *                   This function allows it to write file systems as demons
  1741. +  *                   which stay in memory only as long as needed.
  1742. +  *
  1743. +  * BUG: it is not possible yet to lock such a filesystem.
  1744. +  */
  1745. + /* here we start with gemdos only file system device numbers */
  1746. + static curr_dev_no = 0x100;
  1747. + static long ARGS_ON_STACK
  1748. + uni_fscntl(dir, name, cmd, arg)
  1749. +     fcookie *dir;
  1750. +     const char *name;
  1751. +     int cmd;
  1752. +     long arg;
  1753. + {
  1754. +     fcookie fc;
  1755. +     long r;
  1756. +     extern struct kerinfo kernelinfo;
  1757. +     extern FILESYS *active_fs;
  1758. +     if (cmd == FS_INSTALL) { /* install a new filesystem */
  1759. +         struct fs_descr *d = (struct fs_descr*)arg;
  1760. +         FILESYS *fs;
  1761. +     /* check if FS is installed already */
  1762. +         for (fs = active_fs;  fs;  fs = fs->next)
  1763. +             if (d->file_system == fs)  return 0L;
  1764. +     /* include new file system into chain of file systems */
  1765. +         d->file_system->next = active_fs;
  1766. +         active_fs = d->file_system;
  1767. +         return (long)&kernelinfo;  /* return pointer to kernel info as OK */
  1768. +     } else if (cmd == FS_MOUNT) {  /* install a new gemdos-only device for this FS */
  1769. +         struct fs_descr *d = (struct fs_descr*)arg;
  1770. +         FILESYS *fs;
  1771. +         UNIFILE *u;
  1772. +     /* first check for existing names */
  1773. +         r = uni_lookup(dir, name, &fc);
  1774. +         if (r == 0) {
  1775. +             release_cookie(&fc);
  1776. +             return EACCDN;   /* name exists already */
  1777. +         }
  1778. +         if (r != EFILNF) return r; /* some other error */
  1779. +         if (!d) return EACCDN;
  1780. +         if (!d->file_system) return EACCDN;
  1781. +     /* check if FS is installed */
  1782. +         for (fs = active_fs;  fs;  fs = fs->next)
  1783. +             if (d->file_system == fs)  break;
  1784. +         if (!fs) return EACCDN;  /* not installed, so return an error */
  1785. +         u = kmalloc(SIZEOF(UNIFILE));
  1786. +         if (!u) return EACCDN;
  1787. +         strncpy(u->name, name, NAME_MAX);
  1788. +         u->name[NAME_MAX] = 0;
  1789. +         u->mode = S_IFDIR|DEFAULT_DIRMODE;
  1790. +         u->data = 0;
  1791. +         u->fs = d->file_system;
  1792. +     /* now get the file system its own device number */
  1793. +         u->dev = d->dev_no = curr_dev_no++;
  1794. +     /* chain new entry into unifile list */
  1795. +         u->next = u_root;
  1796. +         u_root = u;
  1797. +         return (long)u->dev;
  1798. +     } else if (cmd == FS_UNMOUNT) {  /* remove a file system's directory */
  1799. +         struct fs_descr *d = (struct fs_descr*)arg;
  1800. +         FILESYS *fs;
  1801. +         UNIFILE *u;
  1802. +     /* first check that directory exists */
  1803. +         r = uni_lookup(dir, name, &fc);
  1804. +         if (r != 0)  return EFILNF;   /* name does not exist */
  1805. +         if (!d) return EFILNF;
  1806. +         if (!d->file_system) return EFILNF;
  1807. +         if (d->file_system != fc.fs)
  1808. +             return EFILNF;  /* not the right name! */
  1809. +         u = (UNIFILE*)fc.index;
  1810. +         release_cookie(&fc);
  1811. +         if (!u || (u->fs != d->file_system))
  1812. +             return EFILNF;
  1813. +     /* check if FS is installed */
  1814. +         for (fs = active_fs;  fs;  fs = fs->next)
  1815. +             if (d->file_system == fs)  break;
  1816. +         if (!fs) return EACCDN;  /* not installed, so return an error */
  1817. +     /* here comes the difficult part: we have to close all files on that
  1818. +      * device, so we have to call changedrv(). The file system driver
  1819. +      * has to make sure that further calls to fs.root() with this device
  1820. +      * number will fail!
  1821. +      *
  1822. +      * Kludge: mark the directory as a link, so uni_remove will remove it.
  1823. +      */
  1824. +         changedrv(u->dev);
  1825. +         u->mode &= ~S_IFMT;
  1826. +         u->mode |= S_IFLNK;
  1827. +         return uni_remove(dir, name);
  1828. +     } else if (cmd == FS_UNINSTALL) {    /* remove file system from kernel list */
  1829. +         struct fs_descr *d = (struct fs_descr*)arg;
  1830. +         FILESYS *fs, *last_fs;
  1831. +         UNIFILE *u;
  1832. +     /* first check if there are any files or directories associated with
  1833. +      * this file system
  1834. +      */
  1835. +         for (u = u_root;  u;  u = u->next)
  1836. +             if (u->fs == d->file_system)
  1837. +                 return EACCDN;   /* we cannot remove it before unmount */
  1838. +         last_fs = 0;
  1839. +         fs = active_fs;
  1840. +         while (fs)  {   /* go through the list and remove the file system */
  1841. +             if (fs == d->file_system)  {
  1842. +                 if (last_fs)
  1843. +                     last_fs->next = fs->next;
  1844. +                 else
  1845. +                     active_fs = fs->next;
  1846. +                 d->file_system->next = 0;
  1847. +                 return 0;
  1848. +             }
  1849. +             last_fs = fs;
  1850. +             fs = fs->next;
  1851. +         }
  1852. +         return EFILNF;
  1853. +     } else {
  1854. +     /* see if we should just pass this along to another file system */
  1855. +         r = uni_lookup(dir, name, &fc);
  1856. +         if (r == 0) {
  1857. +             if (fc.fs != &uni_filesys) {
  1858. +                 r = (*fc.fs->fscntl)(&fc, ".", cmd, arg);
  1859. +                 release_cookie(&fc);
  1860. +                 return r;
  1861. +             }
  1862. +             release_cookie(&fc);
  1863. +         }
  1864. +     }
  1865. +     return EINVFN;
  1866.   }
  1867. *** 1.7    1993/06/25 21:14:36
  1868. --- util.c    1993/08/13 19:00:52
  1869. ***************
  1870. *** 1,6 ****
  1871.   /*
  1872.   Copyright 1990,1991,1992 Eric R. Smith.
  1873. ! Copyright 1992 Atari Corporation.
  1874.   All rights reserved.
  1875.   */
  1876.   
  1877. --- 1,6 ----
  1878.   /*
  1879.   Copyright 1990,1991,1992 Eric R. Smith.
  1880. ! Copyright 1992,1993 Atari Corporation.
  1881.   All rights reserved.
  1882.   */
  1883.   
  1884. ***************
  1885. *** 107,113 ****
  1886.    * kernel memory allocation routines
  1887.    */
  1888.   
  1889. ! #define KERMEM_THRESHOLD QUANTUM-8
  1890.   #define KMAGIC ((MEMREGION *)0x87654321L)
  1891.   #define NKMAGIC 0x19870425L
  1892.   
  1893. --- 107,118 ----
  1894.    * kernel memory allocation routines
  1895.    */
  1896.   
  1897. ! #define KERMEM_THRESHOLD (QUANTUM-8)
  1898. ! #if 0
  1899. ! #define KERMEM_SIZE QUANTUM
  1900. ! #else
  1901. ! #define KERMEM_SIZE ((KERMEM_THRESHOLD+8)*2)
  1902. ! #endif
  1903.   #define KMAGIC ((MEMREGION *)0x87654321L)
  1904.   #define NKMAGIC 0x19870425L
  1905.   
  1906. ***************
  1907. *** 115,121 ****
  1908.   kmalloc(size)
  1909.       long size;
  1910.   {
  1911. !     MEMREGION *m = 0;
  1912.       MEMREGION **p;
  1913.       long *lp;
  1914.   
  1915. --- 120,126 ----
  1916.   kmalloc(size)
  1917.       long size;
  1918.   {
  1919. !     MEMREGION *m;
  1920.       MEMREGION **p;
  1921.       long *lp;
  1922.   
  1923. ***************
  1924. *** 142,155 ****
  1925.           DEBUG(("kmalloc(%lx): nalloc is out of memory",size));
  1926.   
  1927.       /* If this is commented out, then we fall through to try_getregion */
  1928. !         if (0 == (m = get_region(alt, QUANTUM, PROT_S))) {
  1929. !             if (0 == (m = get_region(core, QUANTUM, PROT_S))) {
  1930.               DEBUG(("No memory for another arena"));
  1931.               goto try_getregion;
  1932.               }
  1933.           }
  1934. !         nalloc_arena_add((void *)m->loc,QUANTUM);
  1935. !         m = 0;
  1936.           goto tryagain;
  1937.           }
  1938.       }
  1939. --- 147,162 ----
  1940.           DEBUG(("kmalloc(%lx): nalloc is out of memory",size));
  1941.   
  1942.       /* If this is commented out, then we fall through to try_getregion */
  1943. !         if (0 == (m = get_region(alt, KERMEM_SIZE, PROT_S))) {
  1944. !             if (0 == (m = get_region(core, KERMEM_SIZE, PROT_S))) {
  1945.               DEBUG(("No memory for another arena"));
  1946.               goto try_getregion;
  1947.               }
  1948.           }
  1949. !         lp = (long *)m->loc;
  1950. !         *lp++ = (long)KMAGIC;
  1951. !         *lp++ = (long)m;
  1952. !         nalloc_arena_add((void *)lp,KERMEM_SIZE);
  1953.           goto tryagain;
  1954.           }
  1955.       }
  1956. *** 1.7    1993/06/25 21:14:36
  1957. --- xbios.c    1993/08/12 21:38:22
  1958. ***************
  1959. *** 29,35 ****
  1960.    * unexpectedly. So we play some dirty tricks here: the function
  1961.    * call is treated like a signal handler, and we take advantage
  1962.    * of the fact that no context switches will take place while
  1963. !  * in supervisor mode. ASSUMPTION: the user will not choose to
  1964.    * switch back to user mode, or if s/he does it will be as part
  1965.    * of a longjmp().
  1966.    *
  1967. --- 29,35 ----
  1968.    * unexpectedly. So we play some dirty tricks here: the function
  1969.    * call is treated like a signal handler, and we take advantage
  1970.    * of the fact that no context switches will take place while
  1971. !  * in supervisor mode. ASSTMPTION: the user will not choose to
  1972.    * switch back to user mode, or if s/he does it will be as part
  1973.    * of a longjmp().
  1974.    *
  1975. ***************
  1976. *** 260,276 ****
  1977.   }
  1978.   
  1979.   
  1980. ! long
  1981.   dosound(ptr)
  1982. !     char *ptr;
  1983.   {
  1984. -     char c;
  1985.       MEMREGION *r;
  1986.   
  1987. !     if (!no_mem_prot) {
  1988.       /* check that this process has access to the memory */
  1989.       /* (if not, the next line will cause a bus error) */
  1990. !         c = *((volatile char *)ptr);
  1991.   
  1992.       /* OK, now make sure that interrupt routines will have access,
  1993.        * too
  1994. --- 260,275 ----
  1995.   }
  1996.   
  1997.   
  1998. ! long ARGS_ON_STACK
  1999.   dosound(ptr)
  2000. !     const char *ptr;
  2001.   {
  2002.       MEMREGION *r;
  2003.   
  2004. !     if (!no_mem_prot && ((long)ptr >= 0)) {
  2005.       /* check that this process has access to the memory */
  2006.       /* (if not, the next line will cause a bus error) */
  2007. !         (void)(*((volatile char *)ptr));
  2008.   
  2009.       /* OK, now make sure that interrupt routines will have access,
  2010.        * too
  2011. ***************
  2012. *** 282,289 ****
  2013.           }
  2014.       }
  2015.   
  2016. !     Dosound(ptr);
  2017. !     return 0;
  2018.   }
  2019.   
  2020.   void
  2021. --- 281,287 ----
  2022.           }
  2023.       }
  2024.   
  2025. !     return call_dosound(ptr);
  2026.   }
  2027.   
  2028.   void
  2029. *** 1.7    1993/06/25 21:14:36
  2030. --- asmtab.h    1993/08/10 20:46:58
  2031. ***************
  2032. *** 1,16 ****
  2033. ! #ifndef YYSTYPE
  2034. ! #define YYSTYPE int
  2035. ! #endif
  2036. ! #define    WORD    258
  2037. ! #define    WHITESP    259
  2038. ! #define    EOLN    260
  2039. ! #define    STRING    261
  2040. ! #define    DEFINECMD    262
  2041. ! #define    INCLUDECMD    263
  2042. ! #define    IFDEFCMD    264
  2043. ! #define    IFNDEFCMD    265
  2044. ! #define    ELSECMD    266
  2045. ! #define    ENDIFCMD    267
  2046. ! extern YYSTYPE yylval;
  2047. --- 1,10 ----
  2048. ! #define WORD 257
  2049. ! #define WHITESP 258
  2050. ! #define EOLN 259
  2051. ! #define STRING 260
  2052. ! #define DEFINECMD 261
  2053. ! #define INCLUDECMD 262
  2054. ! #define IFDEFCMD 263
  2055. ! #define IFNDEFCMD 264
  2056. ! #define ELSECMD 265
  2057. ! #define ENDIFCMD 266
  2058. *** 1.7    1993/06/25 21:14:36
  2059. --- file.h    1993/08/10 20:48:46
  2060. ***************
  2061. *** 390,396 ****
  2062. --- 390,405 ----
  2063.   #define PTRACEFLOW    (('P'<< 8) | 9)
  2064.   #define PTRACESTEP    (('P'<< 8) | 10)
  2065.   #define PTRACE11    (('P'<< 8) | 11)
  2066. + #define PLOADINFO    (('P'<< 8) | 12)
  2067.   
  2068. + struct ploadinfo {
  2069. +     /* passed */
  2070. +     short fnamelen;
  2071. +     /* returned */
  2072. +     char *cmdlin, *fname;
  2073. + };
  2074.   #define SHMGETBLK    (('M'<< 8) | 0)
  2075.   #define SHMSETBLK    (('M'<< 8) | 1)
  2076.   
  2077. ***************
  2078. *** 501,506 ****
  2079. --- 510,530 ----
  2080.       short    flags;
  2081.       struct tty *tty;
  2082.       long    reserved[4];
  2083. + };
  2084. + #define FS_INSTALL    0xf001  /* let the kernel know about the file system */
  2085. + #define FS_MOUNT      0xf002  /* make a new directory for a file system */
  2086. + #define FS_UNMOUNT    0xf003  /* remove a directory for a file system */
  2087. + #define FS_UNINSTALL  0xf004  /* remove a file system from the list */
  2088. + struct fs_descr
  2089. + {
  2090. +     FILESYS *file_system;
  2091. +     short dev_no;    /* this is filled in by MiNT if arg == FS_MOUNT*/
  2092. +     long flags;
  2093. +     long reserved[4];
  2094.   };
  2095.   
  2096.   
  2097. *** 1.7    1993/06/25 21:14:36
  2098. --- proc.h    1993/08/10 20:50:12
  2099. ***************
  2100. *** 141,146 ****
  2101. --- 141,150 ----
  2102.    * programs should *not* try to read this stuff via the U:\PROC dir.
  2103.    */
  2104.   
  2105. +     /* jr: two fields to hold information passed to Pexec */
  2106. +     char    fname[PATH_MAX];    /* name of binary */
  2107. +     char    cmdlin[128];        /* original command line */
  2108.       char    name[PNAMSIZ+1];    /* process name            */
  2109.       TIMEOUT    *alarmtim;        /* alarm() event        */
  2110.       short    slices;            /* number of time slices before this
  2111. *** 1.7    1993/06/25 21:14:36
  2112. --- proto.h    1993/08/13 17:27:22
  2113. ***************
  2114. *** 30,35 ****
  2115. --- 30,36 ----
  2116.   long ARGS_ON_STACK rsconf P_((int, int, int, int, int, int));
  2117.   long ARGS_ON_STACK bconmap P_((int));
  2118.   long ARGS_ON_STACK cursconf P_((int, int));
  2119. + long ARGS_ON_STACK dosound P_((const char *ptr));
  2120.   void init_xbios P_((void));
  2121.   
  2122.   /* console.c */
  2123. ***************
  2124. *** 169,174 ****
  2125. --- 170,176 ----
  2126.   void init_drive P_((int drv));
  2127.   void init_filesys P_((void));
  2128.   void load_filesys P_((void));
  2129. + void load_devdriver P_((void));
  2130.   void close_filesys P_((void));
  2131.   void ARGS_ON_STACK changedrv P_((unsigned drv));
  2132.   int disk_changed P_((int drv));
  2133. ***************
  2134. *** 216,222 ****
  2135.   long max_rsize P_((MMAP map));
  2136.   long tot_rsize P_((MMAP map, int flag));
  2137.   virtaddr alloc_region P_((MMAP map, ulong size, int mode));
  2138. ! MEMREGION *create_env P_((const char *env));
  2139.   MEMREGION *create_base P_((const char *cmd, MEMREGION *env, ulong flags, ulong prgsize));
  2140.   MEMREGION *load_region P_((const char *name, MEMREGION *env, const char *cmdlin, XATTR *x,
  2141.               MEMREGION **text, long *fp));
  2142. --- 218,224 ----
  2143.   long max_rsize P_((MMAP map));
  2144.   long tot_rsize P_((MMAP map, int flag));
  2145.   virtaddr alloc_region P_((MMAP map, ulong size, int mode));
  2146. ! MEMREGION *create_env P_((const char *env, ulong flags));
  2147.   MEMREGION *create_base P_((const char *cmd, MEMREGION *env, ulong flags, ulong prgsize));
  2148.   MEMREGION *load_region P_((const char *name, MEMREGION *env, const char *cmdlin, XATTR *x,
  2149.               MEMREGION **text, long *fp));
  2150. *** 1.7    1993/06/25 21:14:36
  2151. --- sproto.h    1993/08/12 21:41:30
  2152. ***************
  2153. *** 33,38 ****
  2154. --- 33,39 ----
  2155.   /* syscall.s */
  2156.   char * ARGS_ON_STACK lineA0 P_((void));
  2157.   void ARGS_ON_STACK call_aes P_((short **));
  2158. + long ARGS_ON_STACK call_dosound P_((const void *));
  2159.   long ARGS_ON_STACK callout P_((long, ...));
  2160.   long ARGS_ON_STACK callout1 P_((long, int));
  2161.   long ARGS_ON_STACK callout2 P_((long, int, int));
  2162. *** 1.7    1993/06/25 21:14:36
  2163. --- version.h    1993/08/12 21:20:36
  2164. ***************
  2165. *** 1,5 ****
  2166.   #define MAJ_VERSION    1
  2167. ! #define MIN_VERSION    7
  2168.   
  2169.   #ifndef MULTITOS
  2170.   #define BETA
  2171. --- 1,5 ----
  2172.   #define MAJ_VERSION    1
  2173. ! #define MIN_VERSION    9
  2174.   
  2175.   #ifndef MULTITOS
  2176.   #define BETA
  2177. *** 1.7    1993/06/25 21:14:36
  2178. --- asm.y    1993/08/10 20:46:46
  2179. ***************
  2180. *** 1,4 ****
  2181. - /* Infix notation calculator--calc */
  2182.   
  2183.   %{
  2184.   #define YYSTYPE char *
  2185. --- 1,3 ----
  2186. ***************
  2187. *** 173,181 ****
  2188.           do_define("dc.w", ".word");
  2189.           do_define("dc.b", ".byte");
  2190.       } else if (syntax == ASM) {
  2191. !         do_define("TEXT", "SECTION TEXT");
  2192. !         do_define("DATA", "SECTION DATA");
  2193. !         do_define("BSS", "SECTION BSS");
  2194.       }
  2195.   }
  2196.   
  2197. --- 172,180 ----
  2198.           do_define("dc.w", ".word");
  2199.           do_define("dc.b", ".byte");
  2200.       } else if (syntax == ASM) {
  2201. !         do_define("TEXT", "SECTION TEXT,CODE");
  2202. !         do_define("DATA", "SECTION DATA,DATA");
  2203. !         do_define("BSS", "SECTION BSS,BSS");
  2204.       }
  2205.   }
  2206.   
  2207.